/******************************************************************************
 *                                                                            *
 *               (c) 2008-2009 HutLab. All rights reserved.                   *
 *                        Eduardo Henrique Leite                              *
 *                                                                            *
 ******************************************************************************

 History:
 Created 01/01/2009

 */

package hutlab.sudoku.engine.base;

import javax.microedition.lcdui.*;

/**
 * Base class for elements displayed in game.
 */
public abstract class GameObject {

    // ----- FIELDS -----
    private int mX;
    private int mY;

    // ----- GETTERS -----

    /**
     * Returns object's horizontal position.
     */
    public int getX(){
        return mX;
    }

    /**
     * Returns object's vertical position.
     */
    public int getY(){
        return mY;
    }

    // ----- SETTERS -----

    /**
     * Sets object's horizontal position.
     */
    public void setX(int x){
        mX = x;
    }

    /**
     * Sets object's vertical position.
     */
    public void setY(int y){
        mY = y;
    }

    // ----- ABSTRACT METHODS -----

    /**
     * Renders the object onto the screen.
     */
    abstract public void render(Graphics graphics);

    /**
     * Handles keyboard events.
     */
    abstract public int keyCommand(int keyCode);

    // ----- CONSTANTS -----

    /**
     * Keycode for key 0.
     */
    public static final int SUDOKU_KEY_0 = 48;

    /**
     * Keycode for key 1.
     */
    public static final int SUDOKU_KEY_1 = 49;

    /**
     * Keycode for key 2.
     */
    public static final int SUDOKU_KEY_2 = 50;

    /**
     * Keycode for key 3.
     */
    public static final int SUDOKU_KEY_3 = 51;

    /**
     * Keycode for key 4.
     */
    public static final int SUDOKU_KEY_4 = 52;

    /**
     * Keycode for key 5.
     */
    public static final int SUDOKU_KEY_5 = 53;

    /**
     * Keycode for key 6.
     */
    public static final int SUDOKU_KEY_6 = 54;

    /**
     * Keycode for key 7.
     */
    public static final int SUDOKU_KEY_7 = 55;

    /**
     * Keycode for key 8.
     */
    public static final int SUDOKU_KEY_8 = 56;

    /**
     * Keycode for key 9.
     */
    public static final int SUDOKU_KEY_9 = 57;

    /**
     * Keycode for key #.
     */
    public static final int SUDOKU_KEY_POUND = 35;

    /**
     * Keycode for key *.
     */
    public static final int SUDOKU_KEY_STAR = 42;

    /**
     * Keycode for key UP.
     */
    public static final int SUDOKU_KEY_UP = -1;

    /**
     * Keycode for key DOWN.
     */
    public static final int SUDOKU_KEY_DOWN = -2;

    /**
     * Keycode for key LEFT.
     */
    public static final int SUDOKU_KEY_LEFT = -3;

    /**
     * Keycode for key RIGHT.
     */
    public static final int SUDOKU_KEY_RIGHT = -4;

    /**
     * Keycode for key OK.
     */
    public static final int SUDOKU_KEY_OK = -5;

    /**
     * Keycode for left select key.
     */
    public static final int SUDOKU_COMMAND_LEFT = -6;

    /**
     * Keycode for right select key.
     */
    public static final int SUDOKU_COMMAND_RIGHT = -7;
}
